<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<link href="images/reset.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet" type="text/css" />
<link href="images/system.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet" type="text/css" />
<link href="images/table_form.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="{yun:}$config.sy_weburl{/yun}/js/jscolor/jscolor.js?v={yun:}$config.cachecode{/yun}"></script>
<script src="{yun:}$config.sy_weburl{/yun}/js/jquery-1.8.0.min.js?v={yun:}$config.cachecode{/yun}"></script>
<link href="{yun:}$config.sy_weburl{/yun}/js/layui/css/layui.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet" type="text/css" />
<script src="{yun:}$config.sy_weburl{/yun}/js/layui/layui.js?v={yun:}$config.cachecode{/yun}"></script>
<script src="{yun:}$config.sy_weburl{/yun}/js/layui/phpyun_layer.js?v={yun:}$config.cachecode{/yun}"></script>
<script src="js/admin_public.js?v={yun:}$config.cachecode{/yun}" language="javascript"></script>
<title>后台管理</title>
</head>

<body class="body_ifm">
	<div class="infoboxp">
		<div class="admin_new_tip">
			<a href="javascript:;" class="admin_new_tip_close"></a>
			<a href="javascript:;" class="admin_new_tip_open" style="display:none;"></a>
			<div class="admin_new_tit"><i class="admin_new_tit_icon"></i>操作提示</div>
			<div class="admin_new_tip_list_cont">
				<div class="admin_new_tip_list">该页面展示了网站充值卡信息，可对充值卡操作。</div>
			</div>
		</div>

		<div class="clear"></div>

		<div class="admin_new_search_box">
			<form action="index.php" name="myform" method="get">
				<input name="m" value="admin_prepaid" type="hidden"/>
				<div class="admin_new_search_name">搜索类型：</div>
				
				<div class="admin_Filter_text formselect" did="dctype">
					<input type="button" {yun:}if $smarty.get.ctype=='2'{/yun} value="使用者" {yun:}else{/yun} value="编号" {yun:}/if{/yun} class="admin_Filter_but" id="bctype">
					<input type="hidden" name="ctype" id="ctype"/>
					
					<div class="admin_Filter_text_box" style="display:none" id="dctype">
						<ul>
							<li><a href="javascript:void(0)" onClick="formselect('1','ctype','编号')">编号</a></li>
							<li><a href="javascript:void(0)" onClick="formselect('2','ctype','使用者')">使用者</a></li>
						</ul>
					</div>
				</div>
				<input class="admin_Filter_search"  type="text" name="keyword"  size="25">
				
				<input class="admin_Filter_bth" type="submit" name="news_search" style="cursor:pointer;" value="搜索"/>

				<a  href="javascript:void(0)" onclick="$('.admin_screenlist_box').toggle();"   class="admin_new_search_gj">高级搜索</a>

 				<a href="index.php?m=admin_prepaid&c=add" class="admin_new_cz_tj" style="width:118px;">+ 批量生成充值卡</a>
 				<a href="javascript:ExportCard();" class="admin_new_cz_tj" style="width:118px;">导出</a>
 			</form>
			{yun:}include file="admin/admin_search.htm"{/yun}
		</div>

		<div class="clear"></div>

		<div class="table-list">
			<div class="admin_table_border">
				
				<iframe id="supportiframe"  name="supportiframe" onload="returnmessage('supportiframe');" style="display:none"></iframe>
				<form action="index.php" name="myform" method="get"  target="supportiframe" id='myform'>
					<input type="hidden" name="m" value="admin_prepaid">
					<input type="hidden" name="c" value="del">
					<input type="hidden" name="pytoken" id='pytoken' value="{yun:}$pytoken{/yun}">
					
					<table width="100%">
						<thead>
							<tr class="admin_table_top">
								<th width="5%"><label for="chkall"><input type="checkbox" id='chkAll'  onclick='CheckAll(this.form)'/></label></th>
								<th>编号</th>
								<th>密码</th>
								<th>抵用额度</th>
								<th>有效期</th>
								<th>使用者/使用时间</th> 
								<th>是否可用</th> 
								<th class="admin_table_th_bg" width="180">操作</th>
							</tr>
						</thead>
						<tbody>

							{yun:}foreach item=v key=key from=$rows{/yun}
								<tr align="center"{yun:}if ($key+1)%2=='0'{/yun}class="admin_com_td_bg"{yun:}/if{/yun} id="list{yun:}$v.id{/yun}">
									<td><input type="checkbox" value="{yun:}$v.id{/yun}" class="check_all" name='del[]' onclick='unselectall()' rel="del_chk" /></td>
									<td><span>{yun:}$v.card{/yun}</span></td>
									<td>{yun:}$v.password{/yun}</td>
									<td>{yun:}$v.quota{/yun}</td>
									<td>
										{yun:}if $v.username{/yun}
											<font color="green">已使用</font>
										{yun:}elseif $v.etime lt time(){/yun}
											<font color="red">已过期</font>
										{yun:}else{/yun}
											{yun:}$v.stime|date_format:'%Y-%m-%d %H:%M:%S'{/yun} 至 {yun:}$v.etime|date_format:'%Y-%m-%d %H:%M:%S'{/yun}
										{yun:}/if{/yun}
									</td>
									<td>
										{yun:}if $v.username{/yun}
											{yun:}$v.username{/yun}
										{yun:}/if{/yun}
										{yun:}if $v.utime{/yun}
											<br/>{yun:}$v.utime|date_format:'%Y-%m-%d %H:%M:%S'{/yun}
										{yun:}/if{/yun}
									</td>
									<td id="type{yun:}$v.id{/yun}">
										{yun:}if $v.type=="1"{/yun}
											<a href="javascript:void(0);" onClick="rec_up('index.php?m=admin_prepaid&c=rec','{yun:}$v.id{/yun}','2','type');">
												<img src="../config/ajax_img/doneico.gif"></a>
										{yun:}else{/yun}
											<a href="javascript:void(0);" onClick="rec_up('index.php?m=admin_prepaid&c=rec','{yun:}$v.id{/yun}','1','type');">
												<img src="../config/ajax_img/errorico.gif"></a>
										{yun:}/if{/yun}
									</td>
									<td>
										{yun:}if $v.statue!="2"&& !$v.username{/yun}
											<a href="index.php?m=admin_prepaid&c=upcard&id={yun:}$v.id{/yun}" class="admin_new_c_bth admin_n_sc mt5">修改</a> 
										{yun:}/if{/yun}
								
										<a href="javascript:void(0)"  class="admin_new_c_bth admin_new_c_bth_sc mt5" onClick="layer_del('确定要删除？', 'index.php?m=admin_prepaid&c=del&del={yun:}$v.id{/yun}');">删除</a>
									</td>
								</tr>
							{yun:}/foreach{/yun}

							<tr>
								<td align="center"><input type="checkbox" id='chkAll2' onclick='CheckAll2(this.form)' /></td>
								<td colspan="10" >
									<label for="chkAll2">全选</label>&nbsp;
									<input class="admin_button"  type="button" name="delsub" value="删除所选"  onclick="return really('del[]')"/>
								</td>
 							</tr>
							{yun:}if $total > $config.sy_listnum {/yun}
								<tr>
									{yun:}if $pagenum==1{/yun}
										<td colspan="3"> 从 1 到 {yun:}$config.sy_listnum {/yun} ，总共 {yun:}$total{/yun} 条</td>
									{yun:}else if $pagenum > 1 && $pagenum < $pages{/yun}
										<td colspan="3"> 从 {yun:}($pagenum-1) * $config.sy_listnum + 1{/yun} 到 {yun:}$pagenum * $config.sy_listnum{/yun} ，总共 {yun:}$total{/yun} 条</td>
									{yun:}else if $pagenum == $pages{/yun}
										<td colspan="3"> 从 {yun:}($pagenum-1) * $config.sy_listnum + 1{/yun} 到 {yun:}$total{/yun} ，总共 {yun:}$total{/yun} 条</td>
									{yun:}/if{/yun}
									<td colspan="8" class="digg">{yun:}$pagenav{/yun}</td>
								</tr>
							{yun:}/if{/yun}
						</tbody>
					</table>
				</form>
			</div>
		</div>
		<div id="bg" class="admin_bg"></div>
	</div>

	<div id="export" style="display:none;">
		<div style="margin-top:10px;">
 			<form action="index.php?m=admin_prepaid&c=xls" target="supportiframe" method="post" id="formstatus" class="myform">
				<input type="hidden" name="pytoken" value="{yun:}$pytoken{/yun}">
				<input type="hidden" name="where" value="{yun:}$where{/yun}">
				<input name="pid" value="0" type="hidden">
				<div class="admin_resume_dc">
					<label>
						<span class="admin_resume_dc_s">
							<input type="checkbox" class="type" name="type[]" value="card">充值卡编号
						</span>
					</label>
					<label>
						<span class="admin_resume_dc_s">
							<input type="checkbox" class="type" name="type[]" value="password">充值卡密码
						</span>
					</label> 
					<label>
						<span class="admin_resume_dc_s">
							<input type="checkbox" class="type" name="type[]" value="quota">抵用额度
						</span>
					</label>
					<label>
						<span class="admin_resume_dc_s">
							<input type="checkbox" class="type" name="type[]" value="stime">开始时间
						</span>
					</label>
					<label>
						<span class="admin_resume_dc_s">
							<input type="checkbox" class="type" name="type[]" value="etime">截止时间
						</span>
					</label>
					<label>
						<span class="admin_resume_dc_s">
							<input type="checkbox" class="type" name="type[]" value="username">使用者
						</span>
					</label>
					<label>
						<span class="admin_resume_dc_s">
							<input type="checkbox" class="type" name="type[]" value="uid">使用者UID
						</span>
					</label>
					
					<label>
						<span class="admin_resume_dc_s">
							<input type="checkbox" class="type" name="type[]" value="utime">使用时间
						</span>
					</label>
				</div>

				<div class="admin_resume_dc_sub" style="width:390px; margin-top:10px;">
					<input type="button" onClick="check_xls();"  value='确认' class="admin_resume_dc_bth1">
					<input type="button" onClick="layer.closeAll();" class="admin_resume_dc_bth2" value='取消'>
				</div>
			</form>
		</div>
	</div>
</div>

<script>
	layui.use(['laydate'], function(){
		var laydate = layui.laydate
		,$ = layui.$;

		laydate.render({
			elem: '#time'
		});

		laydate.render({
			elem: '#time_end'
		});
	});

	function ExportCard(){
		var codewebarr="";
		$(".check_all:checked").each(function(){  
			if(codewebarr==""){codewebarr=$(this).val();}else{codewebarr=codewebarr+","+$(this).val();}
		});
		if(codewebarr==""){
			parent.layer.msg("请选择需要导出数据！",2,8);return false;
		}else{
			$("input[name=pid]").val(codewebarr);
 			add_class('确认导出','390','240','#export','');
		}
	}

	function check_xls(){
		var type="";
		
		$(".type:checked").each(function(){ 
			if(type==""){type=$(this).val();}else{type=type+","+$(this).val();}
		});
		if(type==""){
			parent.layer.msg("请选择导出字段！",2,8);return false;
		}
		setTimeout(function(){$('.myform').submit()},0);
		layer.closeAll();
	}
	
 
</script>
</body>
</html>